package com.group56.view.userend;

import com.group56.factory.AppCMFactory;
import com.group56.utils.FXMLSrcMenu;
import com.group56.utils.FXMLViewHandler;
import com.group56.view.FrameworkController;
import javafx.scene.Parent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;

import java.io.IOException;

public class AppFrameWork implements FrameworkController {
    public AnchorPane view;
    public Pane navigatorPane;
    public Pane contentPane;

    public void initialize() throws IOException {
        assembleViews();
        registerToMediator();
    }

    @Override
    public void assembleViews() throws IOException {
        FXMLViewHandler.putViewInPane(navigatorPane, FXMLViewHandler.getView(FXMLSrcMenu.UserEnd.NAVIGATOR.getSrc()));
        FXMLViewHandler.putViewInPane(contentPane, FXMLViewHandler.getView(FXMLSrcMenu.UserEnd.HOME_PAGE.getSrc()));
    }

    @Override
    public Pane getContentPane() {
        return contentPane;
    }

    @Override
    public Pane getAdsPane() {
        return null;
    }

    @Override
    public Pane getNavigatorPane() {
        return navigatorPane;
    }

    @Override
    public Pane getFooterPane() {
        return null;
    }


    @Override
    public void registerToMediator() {
        AppCMFactory.getCtrlrMediator().registerController(FXMLSrcMenu.UserEnd.APP_FRAMEWORK.getSrc(), this);
    }

    @Override
    public Parent getView() {
        return view;
    }
}
